package com.jebel.framwork.common.util;

import io.vertx.ext.jwt.JWT;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class TokenDecodeUtil {


    public static void main(String[] args) {
        JWT jwt = new JWT();
        String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwaG9uZW51bSI6ImJjZTI5OWJlNzNlZWFiN2Q3ZDkyOTI5ZTU2MGYxZTU4IiwiaWF0IjoxNTcyODYxMzE1LCJleHAiOjE1NzI5NDc3MTV9.qFZpPDBSYpQtt3GQABXAygsq6UIl_IeHqg5sLfiiDOI";
        //  String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwaG9uZW51bSI6IjE3MTY0ODI4NTczIiwiaWF0IjoxNTcyODMyMzE1LCJleHAiOjE1NzI5MTg3MTV9.eiZY41HWRclijI5J4gemfr_byAkvSPmIlKTt3hTb-Dc";
        // String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwaG9uZW51bSI6IjE3MTY0ODI4NTc5IiwiaWF0IjoxNTcyODMyMzE0LCJleHAiOjE1NzI5MTg3MTR9.Ohuh96_vTqPtz76mH5Dto4-VUUnYE4XeYbJGEZhVpTg";
        String[] segments = token.split("\\.");

        String headerSeg = segments[0];
        String payloadSeg = segments[1];
        Base64.Decoder d = Base64.getUrlDecoder();
        byte[] decode = d.decode(headerSeg.getBytes(StandardCharsets.UTF_8));
        byte[] decode1 = d.decode(payloadSeg.getBytes(StandardCharsets.UTF_8));
        System.out.println(new String(decode));
        System.out.println(new String(decode1));
        System.out.println(CipherCodeToken.deCode("bce299be73eeab7d7d92929e560f1e58"));
    }

}
//{"phonenum":"16744390955","service":"network.QryFeeForWeb","channel":"network","token":"","requestIp":"123.52.70.86"}

//{"phonenum":"16744390958","service":"network.QryFeeForWeb","channel":"network","token":"","requestIp":"123.52.70.86"}

//{"serialNumber":"17113898269","service":"network.QueryUserElementsForWeb","token":"","requestIp":"123.52.70.86"}

//{"phonenum":"17164828572","service":"network.QryFeeForWeb","channel":"network","token":"","requestIp":"219.155.52.29"}

//{"phonenum":"17164828573","service":"network.QryFeeForWeb","channel":"network","token":"","requestIp":"219.155.52.29"}

//{"phonenum":"17164828579","service":"network.QryBillValueSum","channel":"network","token":"","requestIp":"219.155.52.29"}


//{"phonenum":"17090335353","service":"network.QryBillValueSumForHome","channel":"network","token":"","requestIp":"219.143.226.66"}